<?php

namespace app\index\controller;
class Lives extends \app\common\controller\AuthBase {
    //所有方法返回的参数还未按照规定格式返回，后期还要改动
    public function index(){
        
    }
    //新增直播间
    public function add_live(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->add_live($param);
        return $this->output($return);
    }
    //新增广告位
    public function add_adv_place(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return  = $res->add_adv_place($param);
        return $this->output($return);
    }
    //新增栏位
    public function add_nav(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->add_nav($param);
        return $this->output($return);
    }

    //获取直播首页的列表
    public function getLiveList(){
        $param = $this->input();
//        return $param;
        $res = new \app\common\model\lives\Lives();
        $return = $res->getlist($param);
        return $this->output($return);
        
    }
    //需要修改的直播间数据
    public function  edit_lives(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->edit_lives($param);
        return $this->output($return);
    }
    //需要修改的广告位数据
    public function edit_adv_place(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->edit_adv_place($param);
        return $this->output($return);
    }
    //需要的导航栏数据
    public function edit_nav(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return =  $res->edit_nav($param);
        return $this->output($return);
    }
    //修改直播间
    public function update_lives(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->update_lives($param[0],$param['id']);
        return $this->output($return);
    }
    //修改广告位
    public function update_adv_place(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->update_adv_place($param[0],$param['id']);
        return $this->output($return);
    }
    //删除广告位
    public function delete_adv_place(){
        $param = $this->input();
//        return $param;
        $res = new \app\common\model\lives\Lives();
        $return = $res->delete_adv_place($param['lives_id']);
        return $this->output($return);
    }
    //修改栏位
    public function update_nav(){
        $param = $this->input();
//        return $param;
        $res = new \app\common\model\lives\Lives();
        $return = $res->update_nav($param['navname'],$param['live_id'],$param['ifshow']);
        return $this->output($return);
    }
    
    //推荐位新增
    public function add_recommend(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->add_recommend($param);
        return $this->output($return);
    }
    public function getrecommendlist(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->getrecommendlist($param);
        return $return;
    }
    public function getrecommendcount(){
        $res = new \app\common\model\lives\Lives();
        $return = $res->getrecommendcount();
        return $this->output($return);
    }
    public function edit_recommend(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->edit_recommend($param);
        return $this->output($return);
    }
    public function update_commend(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->update_commend($param);
        return $this->output($return);
    }
    //修改推荐位排序
    public function changeorder(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return =  $res->changeorder($param);
        return $this->output($return);
    }
    public function changeorderup(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->changeorderup($param);
        return $this->output($return);
    }
    //获取所有的投放渠道
    public function getdelivery(){
        $res = new \app\common\model\lives\Delivery();
        $return = $res->getdelivery();
        return $this->output($return);
    }
    public function add_delivery(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->add_delivery($param);
        return $this->output($return);
    }
    //获取当前直播间已经绑定的渠道
    public function getlivedelivery(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        
        $return = $res->getlivedelivery($param);
        return $this->output($return);
    }
        public function getindex(){
        $res = new \app\common\model\lives\Lives();
        $return = $res->getindex();
        return $this->output($return);
    }
    
    //获取直播间对应的渠道列表
    public function getdeliverylist(){
        
        $param = $this->input();
        
        $res = new \app\common\model\lives\Lives();
        $return = $res->getdeliverylist($param);
        return $this->output($return);
    }
    //修改投放状态
    public function edit_delivery(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->edit_delivery($param);
        return $this->output($return);
    }
    
    //获取前台的聊天数据
    public function getChatlog(){
        $param = $this->input();
        $params = $this->input();
        $rule = [
            "lid" => 'require|number|max:11',
            "did" => 'require|number|max:11',
            "maxId"=>'number',
        ];
         
        $validate = new \think\Validate($rule);
        if(!$validate->check($params)){
            return $this->output([], $validate->getError());
        }
        $res = new \app\common\model\lives\Lives();
        $return =  $res->getChatlog($param);
        return $this->output($return);
    }
        //获取直播间对应的导航栏
    public function getnav(){
//        return 1;
        //获取直播间id
        $param = $this->input();
//        return $param;
        $res = new \app\common\model\lives\Lives();
        $return = $res->getnav($param);
        return $this->output($return);
    }
    //获取广告位
    public function getAdv(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->getAdv($param);
        return $this->output($return);
    }
    public function getDeliverylists(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->getDelivery($param);
        return $this->output($return);
    }
    //添加渠道投放次数
    public function adddelivery(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->adddelivery($param);
        return $this->output($return);
    }
    public function addshare(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->addshare($param);
        return $this->output($return);
    }
    public function getroom(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->getroom($param);
        return $this->output($return);
    }
    //获取报表的数据
    public function getreportform(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->getreportform($param);
        return $this->output($return);
    
    }
    public function rreportform(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return =  $res->rreportform($param);
        return $this->output($return);
    }

    public function addrecommend(){
        $param = $this->input();
        $res = new \app\common\model\lives\Lives();
        $return = $res->addrecommend($param);
         return $this->output($return);
    }

}